#include <stdio.h>
#include <pthread.h>

pthread_t pthread_id[3];

void * f_thread(void *arg) {
    int j=0;
    int i= *((int *)arg);
    printf("je suis la %d-eme pthread d'identite%d.0x%x\n", i, getpid(), pthread_self());
    for (j=0; j<10; j++) {
        printf("%d => %d\n", i, j);
        sleep(1);
    } 
    for (j=0;j<20000;j++) for (i=0;i<20000;i++) i=i+1-1;
}

main() { 
    int i;
    int debut=time(NULL);
    for (i=0; i<3; i++) 
       f_thread(&i);
    printf("je suis la thread initiale %d.0x%x\n", getpid(), pthread_self());
    printf("temps total = %d\n", time(NULL)-debut);
    
}
